Model fit

Column

Assumption checks

Column

Indices of model fit

Metric Value
AIC 3.1e+05
AICc 3.1e+05
BIC 3.1e+05
Nagelkerke’s R2 0.14
RMSE 2.62
Sigma 0.64

For interpretation of performance metrics, please refer to this documentation.

Parameter estimates

Column

Plot

Column

Tabular summary

Parameter Log-Prevalence SE 95% CI t(67112) p
(Intercept) 1.58 0.02 (1.55, 1.62) 100.19 < .001
argPos (sbj) 0.37 0.02 (0.34, 0.41) 20.67 < .001
definiteness (def) -0.51 0.02 (-0.55, -0.47) -24.75 < .001
np idx -0.03 5.33e-03 (-0.04, -0.02) -5.60 < .001
argPos (sbj) × definiteness (def) 0.09 0.02 (0.05, 0.14) 4.00 < .001
definiteness (def) × np idx 0.04 7.22e-03 (0.03, 0.05) 5.57 < .001

To find out more about table summary options, please refer to this documentation.

Predicted Values

Column

Plot

Column

Tabular summary

Estimated Marginal Means
argPos definiteness Mean 95% CI df
obj indef 4.69 (4.60, 4.78) 67112
sbj indef 6.79 (6.65, 6.94) 67112
obj def 2.97 (2.92, 3.01) 67112
sbj def 4.71 (4.64, 4.78) 67112

Variable predicted: surprisal; Predictors modulated: argPos, definiteness; Predictors averaged: np_idx (1.3); Predictions are on the response-scale.

Estimated Marginal Means
argPos np_idx Mean 95% CI df
obj 0.00 3.78 (3.70, 3.85) 67112
sbj 0.00 5.73 (5.68, 5.78) 67112
obj 1.78 3.71 (3.68, 3.75) 67112
sbj 1.78 5.63 (5.54, 5.72) 67112
obj 3.56 3.65 (3.61, 3.68) 67112
sbj 3.56 5.53 (5.39, 5.68) 67112
obj 5.33 3.59 (3.51, 3.66) 67112
sbj 5.33 5.44 (5.23, 5.65) 67112
obj 7.11 3.52 (3.41, 3.64) 67112
sbj 7.11 5.34 (5.08, 5.62) 67112
obj 8.89 3.46 (3.31, 3.62) 67112
sbj 8.89 5.25 (4.93, 5.60) 67112
obj 10.67 3.40 (3.21, 3.60) 67112
sbj 10.67 5.16 (4.78, 5.57) 67112
obj 12.44 3.34 (3.12, 3.59) 67112
sbj 12.44 5.07 (4.64, 5.54) 67112
obj 14.22 3.29 (3.03, 3.57) 67112
sbj 14.22 4.98 (4.51, 5.51) 67112
obj 16.00 3.23 (2.94, 3.55) 67112
sbj 16.00 4.90 (4.37, 5.49) 67112

Variable predicted: surprisal; Predictors modulated: argPos, np_idx; Predictors averaged: definiteness; Predictions are on the response-scale.

Estimated Marginal Means
definiteness np_idx Mean 95% CI df
indef 0.00 5.87 (5.77, 5.97) 67112
def 0.00 3.69 (3.64, 3.74) 67112
indef 1.78 5.57 (5.51, 5.63) 67112
def 1.78 3.75 (3.73, 3.78) 67112
indef 3.56 5.28 (5.15, 5.41) 67112
def 3.56 3.82 (3.74, 3.91) 67112
indef 5.33 5.01 (4.80, 5.22) 67112
def 5.33 3.89 (3.75, 4.05) 67112
indef 7.11 4.75 (4.47, 5.04) 67112
def 7.11 3.97 (3.75, 4.19) 67112
indef 8.89 4.50 (4.16, 4.87) 67112
def 8.89 4.04 (3.76, 4.35) 67112
indef 10.67 4.27 (3.87, 4.70) 67112
def 10.67 4.11 (3.76, 4.50) 67112
indef 12.44 4.05 (3.60, 4.55) 67112
def 12.44 4.19 (3.77, 4.66) 67112
indef 14.22 3.84 (3.36, 4.39) 67112
def 14.22 4.27 (3.77, 4.83) 67112
indef 16.00 3.64 (3.12, 4.24) 67112
def 16.00 4.35 (3.78, 5.00) 67112

Variable predicted: surprisal; Predictors modulated: definiteness, np_idx; Predictors averaged: argPos; Predictions are on the response-scale.

Estimated Marginal Means
argPos definiteness np_idx Mean 95% CI df
obj indef 0.00 4.88 (4.73, 5.03) 67112
sbj indef 0.00 7.07 (6.95, 7.18) 67112
obj def 0.00 2.93 (2.85, 3.00) 67112
sbj def 0.00 4.64 (4.61, 4.68) 67112
obj indef 1.78 4.62 (4.55, 4.69) 67112
sbj indef 1.78 6.70 (6.54, 6.87) 67112
obj def 1.78 2.98 (2.95, 3.02) 67112
sbj def 1.78 4.73 (4.64, 4.82) 67112
obj indef 3.56 4.38 (4.32, 4.44) 67112
sbj indef 3.56 6.35 (6.10, 6.62) 67112
obj def 3.56 3.04 (3.00, 3.08) 67112
sbj def 3.56 4.82 (4.65, 4.99) 67112
obj indef 5.33 4.16 (4.04, 4.28) 67112
sbj indef 5.33 6.03 (5.69, 6.39) 67112
obj def 5.33 3.09 (3.01, 3.18) 67112
sbj def 5.33 4.91 (4.66, 5.16) 67112
obj indef 7.11 3.94 (3.76, 4.13) 67112
sbj indef 7.11 5.71 (5.30, 6.17) 67112
obj def 7.11 3.15 (3.01, 3.29) 67112
sbj def 7.11 5.00 (4.67, 5.35) 67112
obj indef 8.89 3.74 (3.50, 3.99) 67112
sbj indef 8.89 5.42 (4.93, 5.95) 67112
obj def 8.89 3.21 (3.02, 3.41) 67112
sbj def 8.89 5.09 (4.67, 5.54) 67112
obj indef 10.67 3.55 (3.26, 3.85) 67112
sbj indef 10.67 5.14 (4.59, 5.75) 67112
obj def 10.67 3.27 (3.02, 3.53) 67112
sbj def 10.67 5.18 (4.68, 5.74) 67112
obj indef 12.44 3.36 (3.04, 3.72) 67112
sbj indef 12.44 4.87 (4.27, 5.55) 67112
obj def 12.44 3.33 (3.03, 3.66) 67112
sbj def 12.44 5.28 (4.69, 5.95) 67112
obj indef 14.22 3.19 (2.83, 3.60) 67112
sbj indef 14.22 4.62 (3.98, 5.37) 67112
obj def 14.22 3.39 (3.03, 3.79) 67112
sbj def 14.22 5.38 (4.69, 6.16) 67112
obj indef 16.00 3.02 (2.63, 3.47) 67112
sbj indef 16.00 4.38 (3.70, 5.18) 67112
obj def 16.00 3.45 (3.04, 3.92) 67112
sbj def 16.00 5.48 (4.70, 6.38) 67112

Variable predicted: surprisal; Predictors modulated: argPos, definiteness, np_idx; Predictions are on the response-scale.

Text reports

Column

Textual summary

We fitted a general linear model (Gamma family with a log link) (estimated using ML) to predict surprisal with argPos, definiteness and np_idx (formula: surprisal ~ argPos * definiteness * np_idx). The model’s explanatory power is moderate (Nagelkerke’s R2 = 0.14). The model’s intercept, corresponding to argPos = obj, definiteness = indef and np_idx = 0, is at 1.58 (95% CI (1.55, 1.62), t(67112) = 100.19, p < .001). Within this model:

  • The effect of argPos (sbj) is statistically significant and positive (beta = 0.37, 95% CI (0.34, 0.41), t(67112) = 20.67, p < .001; Std. beta = 0.37, 95% CI (0.34, 0.41))
  • The effect of definiteness (def) is statistically significant and negative (beta = -0.51, 95% CI (-0.55, -0.47), t(67112) = -24.75, p < .001; Std. beta = -0.46, 95% CI (-0.48, -0.43))
  • The effect of np idx is statistically significant and negative (beta = -0.03, 95% CI (-0.04, -0.02), t(67112) = -5.60, p < .001; Std. beta = -0.04, 95% CI (-0.06, -0.03))
  • The effect of argPos (sbj) × definiteness (def) is statistically significant and positive (beta = 0.09, 95% CI (0.05, 0.14), t(67112) = 4.00, p < .001; Std. beta = 0.09, 95% CI (0.05, 0.14))
  • The effect of argPos (sbj) × np idx is statistically significant and positive (beta = 0.04, 95% CI (0.03, 0.05), t(67112) = 5.57, p < .001; Std. beta = 0.06, 95% CI (0.04, 0.08))
  • The effect of (argPos (sbj) × definiteness (def)) × np idx is statistically significant and positive (beta = 0.37, 95% CI (0.34, 0.41), t(67112) = 20.67, p < .001; Std. beta = 0.37, 95% CI (0.34, 0.41))

Standardized parameters were obtained by fitting the model on a standardized version of the dataset. 95% Confidence Intervals (CIs) and p-values were computed using a Wald t-distribution approximation. The model’s explanatory power is moderate (Nagelkerke’s R2 = 0.14)

Column

Model information

---
title: "Regression model summary from `{easystats}`"
output:
  flexdashboard::flex_dashboard:
    theme:
      version: 4
      # bg: "#101010"
      # fg: "#FDF7F7"
      primary: "#0054AD"
      base_font:
        google: Prompt
      code_font:
        google: JetBrains Mono
params:
  model: model
  check_model_args: check_model_args
  parameters_args: parameters_args
  performance_args: performance_args
---

```{r setup, include=FALSE}
library(flexdashboard)
library(easystats)

# Since not all regression model are supported across all packages, make the
# dashboard chunks more fault-tolerant. E.g. a model might be supported in
# `{parameters}`, but not in `{report}`.
#
# For this reason, `error = TRUE`
knitr::opts_chunk$set(
  error = TRUE,
  out.width = "100%"
)

# helper function for printing `{report}` outputs
bracket_to_parantheses <- function(text) {
  gsub("]", ")", gsub("[", "(", text, fixed = TRUE), fixed = TRUE)
}
```

```{r easydashboard-1}
# Get user-specified model data
model <- params$model

# Is it supported by `{easystats}`? Skip evaluation of the following chunks if not.
is_supported <- insight::is_model_supported(model)

if (!is_supported) {
  unsupported_message <- sprintf(
    "Unfortunately, objects of class `%s` are not yet supported in {easystats}.\n
    For a list of supported models, see `insight::supported_models()`.",
    class(model)[1]
  )
}
```


Model fit
=====================================

Column {data-width=700}
-----------------------------------------------------------------------

### Assumption checks

```{r check-model, eval=is_supported, fig.height=10, fig.width=10}
check_model_args <- c(list(model), params$check_model_args)
# add verbose, if not done yet
if (is.null(check_model_args$verbose)) check_model_args$verbose <- FALSE
tryCatch(
  {
    do.call(performance::check_model, check_model_args)
  },
  error = function(e) {
    cat(insight::format_message(
      "\nSomething did not work as expected. Please file an issue at {.url https://github.com/easystats/easystats/issues/} and post the following output:",
      paste0("\n`", e$message, "`")
    ))
  }
)
```

```{r easydashboard-2, eval=!is_supported}
cat(unsupported_message)
```

Column {data-width=300}
-----------------------------------------------------------------------

### Indices of model fit

```{r easydashboard-3, eval=is_supported}
# {performance}
performance_args <- c(list(model), params$performance_args)
# add verbose, if not done yet
if (is.null(performance_args$verbose)) performance_args$verbose <- FALSE
table_performance <- do.call(performance::performance, performance_args)
print_md(table_performance, layout = "vertical", caption = NULL)
```


```{r easydashboard-4, eval=!is_supported}
cat(unsupported_message)
```

For interpretation of performance metrics, please refer to <a href="https://easystats.github.io/performance/reference/model_performance.html" target="_blank">this documentation</a>.

Parameter estimates
=====================================

Column {data-width=550}
-----------------------------------------------------------------------

### Plot

```{r dot-whisker, eval=is_supported}
# `{parameters}`
parameters_args <- c(list(model), params$parameters_args)
# add verbose, if not done yet
if (is.null(parameters_args$verbose)) parameters_args$verbose <- FALSE
table_parameters <- do.call(parameters::parameters, parameters_args)

plot(table_parameters)
```


```{r easydashboard-5, eval=!is_supported}
cat(unsupported_message)
```

Column {data-width=450}
-----------------------------------------------------------------------

### Tabular summary

```{r easydashboard-6, eval=is_supported}
print_md(table_parameters, caption = NULL)
```


```{r easydashboard-7, eval=!is_supported}
cat(unsupported_message)
```

To find out more about table summary options, please refer to <a href="https://easystats.github.io/parameters/reference/model_parameters.html" target="_blank">this documentation</a>.


Predicted Values
=====================================

Column {data-width=600}
-----------------------------------------------------------------------

### Plot

```{r expected-values, eval=is_supported, fig.height=10, fig.width=10}
# {modelbased}
int_terms <- find_interactions(model, component = "conditional", flatten = TRUE)
con_terms <- find_variables(model)$conditional

if (is.null(int_terms)) {
  model_terms <- con_terms
} else {
  model_terms <- clean_names(int_terms)
  int_terms <- unique(unlist(strsplit(clean_names(int_terms), ":", fixed = TRUE)))
  model_terms <- c(model_terms, setdiff(con_terms, int_terms))
}

text_modelbased <- tryCatch(
  {
    lapply(unique(model_terms), function(i) {
      estimate_means(model, by = i, verbose = FALSE)
    })
  },
  error = function(e) {
    cat(insight::format_message(
      "\nSomething did not work as expected. Please file an issue at {.url https://github.com/easystats/easystats/issues/} and post the following output:",
      paste0("\n`", e$message, "`")
    ))
    NULL
  }
)

if (!is.null(text_modelbased)) {
  ggplot2::theme_set(theme_modern())
  # all_plots <- lapply(text_modelbased, function(i) {
  #   out <- do.call(visualisation_recipe, c(list(i), modelbased_args))
  #   plot(out) + ggplot2::ggtitle("")
  # })
  all_plots <- lapply(text_modelbased, function(i) {
    out <- visualisation_recipe(i, join_dots = FALSE, show_data = FALSE)
    plot(out) + ggplot2::ggtitle("")
  })

  see::plots(all_plots, n_columns = round(sqrt(length(text_modelbased))))
}
```


```{r easydashboard-8, eval=!is_supported}
cat(unsupported_message)
```

Column {data-width=400}
-----------------------------------------------------------------------

### Tabular summary

```{r easydashboard-9, eval=is_supported, results="asis"}
if (!is.null(text_modelbased)) {
  for (i in text_modelbased) {
    tmp <- print_md(i)
    tmp[length(tmp)] <- paste(insight::compact_character(strsplit(tmp[length(tmp)], "\n")[[1]]), collapse = "; ")
    print(tmp)
  }
}
```


```{r easydashboard-10, eval=!is_supported}
cat(unsupported_message)
```


Text reports
=====================================

Column {data-width=500}
-----------------------------------------------------------------------

### Textual summary

```{r easydashboard-11, eval=is_supported, results='asis', collapse=TRUE}
# {report}
text_report <- tryCatch(
  {
    report(model, verbose = FALSE)
  },
  error = function(e) {
    cat(insight::format_message(
      "\nSomething did not work as expected. Please file an issue at {.url https://github.com/easystats/easystats/issues/} and post the following output:",
      paste0("\n`", e$message, "`")
    ))
    NULL
  }
)


text_report_performance <- tryCatch(
  {
    report_performance(model, verbose = FALSE)
  },
  error = function(e) {
    cat(insight::format_message(
      "\nSomething did not work as expected. Please file an issue at {.url https://github.com/easystats/easystats/issues/} and post the following output:",
      paste0("\n`", e$message, "`")
    ))
    NULL
  }
)

if (!is.null(text_report)) {
  cat(bracket_to_parantheses(text_report))
  cat("\n")
}

if (!is.null(text_report_performance)) {
  cat(bracket_to_parantheses(text_report_performance))
}
```


```{r easydashboard-12, eval=!is_supported}
cat(unsupported_message)
```

Column {data-width=500}
-----------------------------------------------------------------------

### Model information

```{r easydashboard-13, eval=is_supported}
model_info_data <- insight::model_info(model, verbose = FALSE)
model_info_data <- datawizard::data_to_long(as.data.frame(insight::compact_list(model_info_data)))

DT::datatable(model_info_data)
```

```{r easydashboard-14, eval=!is_supported}
cat(unsupported_message)
```